package com.zlh123.controller;

import com.zlh123.entity.Student;
import com.zlh123.service.StudentService;
import com.zlh123.util.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/student")
@CrossOrigin //跨域访问
public class StudentController {
    @Autowired
    private StudentService studentService;
    //1，获取学生列表
    @GetMapping("/list")
    public List<Student> list() {
        return studentService.findAll();

    }
    //2分野查询学生信息
    @GetMapping("findByPage")
    public PageResult<Student> findByPage(@RequestParam("page") int page,@RequestParam("pageSize") int pageSize ) {
        return studentService.findBypage(page,pageSize);
    }
}
